/*
 *
inherit_protected.cpp: In function ‘int main()’:
inherit_protected.cpp:33:22: error: ‘int Base::m_c’ is inaccessible within this context
   33 |         cout << test.m_c << endl; //protected继承 子类中该变量为protected
      |                      ^~~
inherit_protected.cpp:9:21: note: declared here
    9 |                 int m_c;

 */
#include <iostream>
using namespace std;
class Base{
	private:
		int m_a;
	protected:
		int m_b;
	public:
		int m_c;
		Base(int a=1, int b=2, int c=3){
			m_a = a;
			m_b = b;
			m_c = c;
		}
		int geta(){
			return m_a;
		}
};

class Derived: protected Base{
	public:
		void print(){
			//cout << m_a << endl; //error
			cout << geta() << endl;
			cout << m_b << endl;
			cout << m_c << endl;
		}
};
int main(void){
	Derived test;
	//cout << test.m_a << endl; //  error private
	//cout << test.m_b << endl;  // error protected
	cout << test.m_c << endl; //protected继承 子类中该变量为protected
	return 0;
}

